home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / MacMETH 3.2.1 / MacMETH Manual 1992 / Manual Examples / SystemExample.MOD < prev    next >
Encoding:
Text File  |  1994-09-19  |  1.1 KB  |  39 lines  |  [TEXT/MEDT]

  1. MODULE SystemExample;
  2.  
  3.     (* demonstrates the use of the procedures from module 'System' and module 'FileUtil'.    *)
  4.     (* this program is in fact a very small shell, allowing the user to execute other programs    *)
  5.     (* or to transfer to another application.        *)
  6.  
  7.     FROM System    IMPORT Call, Status;
  8.     FROM FileUtil    IMPORT GetFileName, Transfer, FType;
  9.     FROM Menu    IMPORT MenuRes, SetMenu, GetMenuCmd;
  10.  
  11.     VAR    Command    : MenuRes;
  12.          Done,Ok    : BOOLEAN;
  13.         FileName    : ARRAY [0..63] OF CHAR;
  14.         FileType    : FType;
  15.         TermReason     : Status;
  16.                     
  17. BEGIN
  18.     SetMenu(1,"File|Execute/X|Transfer/T|Quit/Q");
  19.     (* MacMETH sets the type of the object files it creates to 'MOBJ' *)
  20.     FileType := "MOBJ";
  21.     LOOP
  22.         GetMenuCmd(Command,Done);
  23.         IF Done & (Command.menuID = 1) THEN
  24.             CASE Command.menuCmd OF
  25.               1 :     GetFileName(FileName,FileType,Ok);
  26.                     IF Ok THEN
  27.                         Call(FileName,FALSE,TermReason);
  28.                             IF (TermReason # normal) THEN
  29.                             (* Some error occured *)
  30.                         END (* IF *);
  31.                     END (* IF *)
  32.              |2 :     Transfer("")
  33.              |3 :     EXIT
  34.             END (* CASE *);
  35.         END (* IF *)
  36.     END (* LOOP *)
  37. END SystemExample.
  38.  
  39.